<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>订单列表</title>
		<link rel="stylesheet" type="text/css" href="../mobile/js/layer/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />
		<script src="./js/jquery-3.1.1.min.js"></script>
        <script src="./js/jquery-1.9.1.js"></script>
        <script src="../mobile/js/layer/layui.js"></script>
        <script src="./js/common.js"></script>
	</head>
	<body>
		
		<div class="main_bg">
			
			<div class="order_head">
					<b class="meunhead">
						<a href="javascript:void(0)" class="levelmeun active">
							<span>订单列表</span><i class="iconfont">&#xe601;</i>
						</a>
						<span class="twolevelmeun">订单列表</span>
					</b>
					<span class="order_num">共3433记录</span>
					<button class="refresh_btn">刷新</button>
					
					<input type="text" class="seachtext" placeholder="请输入关键字" />
					
					<button class="seachbtn">查找</button>
					
					<button class="iconfont export_btn">&#xe621; 导出订单</button>
			</div>
			
			<div class="orderbox">
				<table width="100%" cellpadding="0" cellspacing="0" class="ordertable">
					<thead>
						<tr>
							<th>ID</th>
							<th>用户</th>
							<th>设备码</th>
							<th>一级代理商</th>
							<th>二级代理商</th>
							<th>订单号</th>
							<th>充值套餐</th>
							<th>充值金额</th>
							<th>充值时间</th>
							<th>一级佣金比例</th>
							<th>二级佣金比例</th>
							<th>状态</th>
							<!--<th>操作</th>-->
						</tr>
					</thead>
					
					<tbody id="orderslist"></tbody>
				</table>
				
				
				<div id="page"></div>
			</div>
		</div>
		
		
	</body>
<script src="./js/jquery-3.1.1.min.js"></script>
<script src="./js/jquery-1.9.1.js"></script>
<script src="./js/common.js"></script>
<script src="../mobile/js/layer/layui.js"></script>


<script>
//var url="http://qt.hiberbest.com";//定义全局变量url
// var url="http://www.xiyiji.com";//定义全局变量url
//首先加载数据
$(function(){
	//访问是否登录,ajax同步请求
	var geturl=url+ "/admin/userlist/orderList";
	$.ajax({
			type: 'get',
			async:false,
			dataType: "json",
			url: geturl,
			success: function (data) {
				// console.log(data);alert(data);
				var count = data.datas.length;
				var order = '';
				for (var k=0; k<count; k++) {
					order +='<tr>';
					order +='<td>'+data.datas[k]['orderid']+'</td>';
					order +='<td>'+data.datas[k]['username']+'</td>';
					order +='<td>'+data.datas[k]['device_id']+'</td>';
					order +='<td>'+data.datas[k]['oneDaili']+'</td>';
					order +='<td>'+data.datas[k]['twoDaili']+'</td>';
					order +='<td>'+data.datas[k]['order_on']+'</td>';
					order +='<td>'+data.datas[k]['taocan']+'</td>';
					order +='<td>'+data.datas[k]['order_money']+'</td>';
					order +='<td>'+data.datas[k]['endtime']+'</td>';
					order +='<td>'+data.datas[k]['yongjin_one']+'</td>';
					order +='<td>'+data.datas[k]['yongjin_two']+'</td>';
					if (data.datas[k]['paystate'] == 1) {
						order +='<td>已支付</td>';
					}else{
						order +='<td>未支付</td>';
					}
					order +='</tr>';
				}
				$('#orderslist').html(order);
				
				layui.use(['laypage', 'layer'], function(){
				var laypage = layui.laypage;
				  //自定义样式
				  laypage.render({
				    elem: 'page'
				    ,count:data.count
				    ,limit: data.limit
				    ,theme: '#35C4F9'
				  });
				});

			},error:function(data){
				console.log("请检查您的网络");
			}
		});
});
//点击分页加载事件
$('#page').click(function(){
	var fenye = $('.layui-laypage-curr').find('em').eq(1).html();
	var geturl=url+ "/admin/userlist/orderList?fenye="+fenye;
	$.ajax({
			type: 'get',
			async:false,
			dataType: "json",
			url: geturl,
			success: function (dete) {
				// console.log(dete);alert(dete);
				var count = dete.datas.length;
				var order = '';
				for (var m=0; m<count; m++) {
					order +='<tr>';
					order +='<td>'+dete.datas[m]['orderid']+'</td>';
					order +='<td>'+dete.datas[m]['username']+'</td>';
					order +='<td>'+dete.datas[m]['device_id']+'</td>';
					order +='<td>'+dete.datas[m]['oneDaili']+'</td>';
					order +='<td>'+dete.datas[m]['twoDaili']+'</td>';
					order +='<td>'+dete.datas[m]['order_on']+'</td>';
					order +='<td>'+dete.datas[m]['taocan']+'</td>';
					order +='<td>'+dete.datas[m]['order_money']+'</td>';
					order +='<td>'+dete.datas[m]['endtime']+'</td>';
					order +='<td>'+dete.datas[m]['yongjin_one']+'</td>';
					order +='<td>'+dete.datas[m]['yongjin_two']+'</td>';
					if (dete.datas[m]['paystate'] == 1) {
						order +='<td>已支付</td>';
					}else{
						order +='<td>未支付</td>';
					}
					order +='</tr>';
				}
				$('#orderslist').html(order);

			},error:function(dete){
				console.log("请检查您的网络");
			}
		});
});
</script>

	
</html>
